import MyPromise from ".";

const p = new MyPromise((resolve, reject) => {
    setTimeout(() => {
        resolve('time1');
    }, 1000);
});

p.then((v) => {
    console.log('success = ', v);
    return '33';
})
.then((v) => {
    console.log('22' + v);
})
.catch((err) => {
    console.log('error = ', err);
});


const p1 = new MyPromise((resolve, reject) => {
    resolve(1);
});
const p2 = new MyPromise((resolve, reject) => {
    resolve(2);
});
const p3 = new MyPromise((resolve, reject) => {
    reject(3);
});


MyPromise.all([p1, p2, p3]).then((arr) => {
    console.log('success' , arr);
})
.catch((err) => {
    console.log('error1', err);
});